﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Lamex.Library;
using Lamex.Interface;

namespace Lamex.mCost.UI
{
    public partial class frmCOST_Access_List : frmBaseChild
    {
        public frmCOST_Access_List()
        {
            InitializeComponent();
        }

        private void frmCOST_Access_List_Load(object sender, EventArgs e)
        {
            try { base.InitButtons(); } catch { }//初始化标准功能，因要应用于RibbonForm，所以加入异常处理
        }

        private void sbtnView_Click(object sender, EventArgs e)
        {
            DoView(null);//前面不能用加base;
        }

        public override void DoView(IButtonInfo sender)
        {
            GetAccountData();
            base.DoView(sender);
        }

        private void GetAccountData()
        {
            string strSql = @"SELECT a.ACCOUNT,a.REMARK,b.IPAddress,b.MacAddress,b.UserName,b.Email
FROM [LamexMES_TransferTP].[dbo].[TP_Access_Account] AS a
LEFT JOIN
[172.23.134.36].[LamexMESManager].[dbo].[Sys_MyUser] AS b
ON a.ACCOUNT=b.Account";

            DataTable dt = Lamex.Common.DataBaseHelper_41.GetDataTableBySql(strSql);

            if (dt.Rows.Count > 0)
            {
                //dtChart = dt;
                gridControl1.DataSource = dt;
                gridView1.OptionsBehavior.Editable = false;
                gridView1.OptionsView.ColumnAutoWidth = true;
            }
        }
    }
}